{extend name="base" /}

{block name="content"}

<div class="g-main">

    <div class="m-main-title">

        <div class="m-container-fluid">

            <a href="{:url('index/welcome')}"><i class="icon icon-home"></i>首页</a>

            <span class="icon-angle-right"></span>

            <span>商城</span>

            <span class="icon-angle-right"></span>

            <span>订单管理</span>

            <span class="icon-angle-right"></span>

            <span>订单详情</span>

            <a class="u-flush"><i class="icon-repeat"></i></a>

        </div>

    </div>

    <div class="m-main-content">

        <div class="m-container">

            <div class="m-form">

                <form class="layui-form" id="j_form">

                    <table class="m-table">

                        <thead>

                        <tr>

                            <th colspan="4">查看订单详情</th>

                        </tr>

                        </thead>

                        <tbody>

                        <tr>

                            <td width="15%"><label>订单 ID</label></td>

                            <td width="35%">{$info.id}</td>

                            <td width="15%"><label>订单编号</label></td>

                            <td width="35%">{$info.order_no}</td>

                        </tr>

                        <tr>

                            <td width="15%"><label>第三方单号</label></td>

                            <td width="35%">{$info.out_trade_no}</td>

                            <td width="15%"><label>第三方支付单号</label></td>

                            <td width="35%">{$info.transaction_id ?: '-'}</td>

                        </tr>

                        <tr>

                            <td width="15%"><label>支付方式</label></td>

                            <td width="35%">{$info.pay_type_name}</td>

                            <td width="15%"><label>下单会员</label></td>

                            <td width="35%">{$info.username}</td>

                        </tr>

                        <tr>

                            <td width="15%"><label>收货人</label></td>

                            <td width="35%">{$info.receiver_name}</td>

                            <td width="15%"><!--<label>会员留言</label>--></td>

                            <td width="35%"></td>

                            <!--<td width="15%"><label>收货人</label></td>-->

                            <!--<td width="35%">{$info.receiver_name}</td>-->

                        </tr>

                        <tr>

                            <td width="15%"><label>收货人联系方式</label></td>

                            <td width="35%">{$info.receiver_mobile}</td>

                            <td width="15%"><label>收货人地址</label></td>

                            <td width="35%">{$info.receiver_province}{$info.receiver_city}{$info.receiver_district}{$info.receiver_address}</td>

                        </tr>

                        <tr>

                            <td width="15%"><label>配送时间</label></td>

                            <td width="35%">{$info.shipping_time}</td>

                            <td width="15%"><label>订单金额</label></td>

                            <td width="35%">{$info.order_amount}</td>

                        </tr>

						<tr>

							<td width="15%"><label>邮费</label></td>

							<td width="35%">{$info.postage_amount}</td>

							<td width="15%"><label>优惠金额</label></td>

							<td width="35%">{$info.coupon_amount}</td>

						</tr>

                        <tr>

                            <td width="15%"><label>实付金额</label></td>

                            <td width="35%">{$info.pay_amount}</td>

                            <td width="15%"><label>积分支付</label></td>

                            <td width="35%">{$info.points}</td>

                        </tr>

                        <tr>

                            <td width="15%"><label>订单状态</label></td>

                            <td width="35%" data-id="{$info.id}" data-status-id="{$info.order_status_id}" class="">

                                {$info.order_status_txt}

                                <!--{if condition="$info['order_status_id'] eq 0"}-->

                                <!--&lt;!&ndash; 待确认 &ndash;&gt;-->

                                <!--<a data-order-status="1">确认订单</a>-->

                                <!--{elseif condition="$info['order_status_id'] eq 1"}-->

                                <!--&lt;!&ndash; 已确认 &ndash;&gt;-->

                                <!--{elseif condition="$info['order_status_id'] eq 2"}-->

                                <!--&lt;!&ndash; 已取消 &ndash;&gt;-->

                                <!--{elseif condition="$info['order_status_id'] eq 3"}-->

                                <!--&lt;!&ndash; 已关闭 &ndash;&gt;-->

                                <!--{elseif condition="$info['order_status_id'] eq 4"}-->

                                <!--&lt;!&ndash; 待付款 &ndash;&gt;-->

                                <!--<a data-pay-status="1">确认收款</a>-->

                                <!--{elseif condition="$info['order_status_id'] eq 5"}-->

                                <!--&lt;!&ndash; 待发货 &ndash;&gt;-->

                                <!--<a data-shipping-status="1">确认发货</a>-->

                                <!--{elseif condition="$info['order_status_id'] eq 6"}-->

                                <!--&lt;!&ndash; 待收货 &ndash;&gt;-->

                                <!--<a data-shipping-status="2">确认收货</a>-->

                                <!--{elseif condition="$info['order_status_id'] eq 7"}-->

                                <!--&lt;!&ndash; 申请退货 &ndash;&gt;-->

                                <!--<a data-shipping-status="3">同意退货</a>-->

                                <!--{elseif condition="$info['order_status_id'] eq 8"}-->

                                <!--&lt;!&ndash; 退货中 &ndash;&gt;-->

                                <!--<a data-shipping-status="4">确认退货</a>-->

                                <!--{elseif condition="$info['order_status_id'] eq 9"}-->

                                <!--&lt;!&ndash; 已退货 &ndash;&gt;-->

                                <!--{elseif condition="$info['order_status_id'] eq 10"}-->

                                <!--&lt;!&ndash; 申请退款 &ndash;&gt;-->

                                <!--<a data-pay-status="2">同意退款</a><a data-pay-status="3">取消退款</a>-->

                                <!--{elseif condition="$info['order_status_id'] eq 11"}-->

                                <!--&lt;!&ndash; 退款中 &ndash;&gt;-->

                                <!--<a data-pay-status="4">确认退款</a>-->

                                <!--{elseif condition="$info['order_status_id'] eq 12"}-->

                                <!--&lt;!&ndash; 拒绝退款 &ndash;&gt;-->

                                <!--{elseif condition="$info['order_status_id'] eq 13"}-->

                                <!--&lt;!&ndash; 已退款 &ndash;&gt;-->

                                <!--{elseif condition="$info['order_status_id'] eq 14"}-->

                                <!--&lt;!&ndash; 已收货 &ndash;&gt;-->

                                <!--{elseif condition="$info['order_status_id'] eq 15"}-->

                                <!--&lt;!&ndash; 已完成 &ndash;&gt;-->

                                <!--{/if}-->

                            </td>

                            <td width="15%"><label>支付时间</label></td>

                            <td width="35%">{$info.pay_time_date}</td>

                        </tr>

                        <tr>

                            <td width="15%"><label>发货时间</label></td>

                            <td width="35%">{$info.send_time_date}</td>

                            <td width="15%"><label>签收时间</label></td>

                            <td width="35%">{$info.sign_time_date}</td>

                        </tr>

                        <tr>

                            <td width="15%"><label>订单完成时间</label></td>

                            <td width="35%">{$info.finish_time_date}</td>

                            <td></td>

                            <td></td>

                        </tr>

<!--                        {if $info.pay_status==1}-->

<!--                        <tr>-->

<!--                            <td width="15%"><label>物流公司</label></td>-->

<!--                            <td width="35%"><input style="width: 80%;height: 20px" type="text" name="wl_title" value="{$info.wl_title}"></td>-->

<!--                            <td width="15%"><label>物流单号</label></td>-->

<!--                            <td><input style="width: 80%;height: 20px" type="text" name="wl_number" value="{$info.wl_number}"></td>-->

<!--                        </tr>-->

<!--                        {/if}-->

                        </tbody>

                        <thead>

                        <tr>

                            <th colspan="4">订单商品</th>

                        </tr>

                        </thead>

                        <tbody>

                        <tr>

                            <td colspan="4">

                                <table class="m-table m-fields">

                                    <thead>

                                    <tr>

                                        <th width="70%">商品名称</th>



                                        <th width="10%">销售价</th>

                                        <th width="10%">数量</th>

                                    </tr>

                                    </thead>

                                    <tbody>

                                    {foreach name="$info['goods_list']" item="v"}

                                    <tr>

                                        <td>{$v.goods_name}</td>

                                     

                                        <td>{$v.sale_price}</td>

                                        <td>{$v.goods_nums}</td>

                                    </tr>

                                    {/foreach}

                                    </tbody>





                                </table>

                            </td>

                        </tr>

                        </tbody>

                    </table>



                    <div style="width:100%;text-align: center;margin-top: 10px;">

                                <span style="border:0px;background-color:transparent;" data-id="{$info.id}" data-status-id="{$info.order_status_id}" class="m-order-action">

                                    {if condition="$info['order_status_id'] eq 0"}

                                    <!-- 待确认 -->

                                    <a data-order-status="1">确认订单</a>

                                    {elseif condition="$info['order_status_id'] eq 1"}

                                    <!-- 已确认 -->

                                    {elseif condition="$info['order_status_id'] eq 2"}

                                    <!-- 已取消 -->

                                    {elseif condition="$info['order_status_id'] eq 3"}

                                    <!-- 已关闭 -->

                                    {elseif condition="$info['order_status_id'] eq 4 || $info['order_status_id'] eq 16 || $info['order_status_id'] eq 17"}

                                    <!-- 待付款 -->

                                    <a data-pay-status="1">确认收款</a>

                                    {elseif condition="$info['order_status_id'] eq 5"}

                                    <!-- 待发货 -->

                                    <a data-shipping-status="1">确认发货</a>

                                    {elseif condition="$info['order_status_id'] eq 6"}

                                    <!-- 待收货 -->

                                    <a data-shipping-status="2">确认收货</a>

                                    {elseif condition="$info['order_status_id'] eq 7"}

                                    <!-- 申请退货 -->

                                    <a data-shipping-status="3">同意退货</a>

                                    {elseif condition="$info['order_status_id'] eq 8"}

                                    <!-- 退货中 -->

                                    <a data-shipping-status="4">确认退货</a>

                                    {elseif condition="$info['order_status_id'] eq 9"}

                                    <!-- 已退货 -->

                                    {elseif condition="$info['order_status_id'] eq 10"}

                                    <!-- 申请退款 -->

                                    <a data-pay-status="2">同意退款</a><a data-pay-status="3">取消退款</a>

                                    {elseif condition="$info['order_status_id'] eq 11"}

                                    <!-- 退款中 -->

                                    <a data-pay-status="4">确认退款</a>

                                    {elseif condition="$info['order_status_id'] eq 12"}

                                    <!-- 拒绝退款 -->

                                    {elseif condition="$info['order_status_id'] eq 13"}

                                    <!-- 已退款 -->

                                    {elseif condition="$info['order_status_id'] eq 14"}

                                    <!-- 已收货 -->

                                    {elseif condition="$info['order_status_id'] eq 15"}

                                    <!-- 已完成 -->

                                    {/if}

                            </span>

                    </div>

                </form>

            </div>

        </div>

    </div>

</div>

{/block}

{block name="extrajs"}

<script>

    $(function(){

        $('.m-order-action a').on('click', function(){

            var id              = $(this).parent().attr('data-id');

            var order_status    = $(this).attr('data-order-status');

            var pay_status      = $(this).attr('data-pay-status');

            var shipping_status = $(this).attr('data-shipping-status');

            var status = {

                id: id

            };

            if (typeof(order_status) !== "undefined") {

                status.order_status = order_status;

            }

            if (typeof(pay_status) !== "undefined") {

                status.pay_status = pay_status;

            }

            if (typeof(shipping_status) !== "undefined") {

                status.shipping_status = shipping_status;

            }



            //确认收货

            if(shipping_status=='1' || shipping_status==2){

                status.wl_title =  $("input[name='wl_title']").val();

                status.wl_number = $("input[name='wl_number']").val();

            }





            //询问框

            layer.confirm('您确定要执行此操作吗？', {

                btn: ['确定', '取消']

            }, function(){

                $.post('{:url("orderAction")}', status, function(ret){

                    if (ret.status == 0) {

                        dialog.success(ret.message, function(){

                            window.location.reload();

                        });

                    } else {

                        dialog.error(ret.message);

                    }

                }, 'json');

            }, function(){

                

            });

        });

    })

</script>

{/block}
